package com.yy.jhl.ui.manager.presenter;

import com.yy.jhl.api.Api;
import com.yy.jhl.api.RxSubscriber;
import com.yy.jhl.ui.manager.contract.OutboundSubmitContract;

import org.json.JSONArray;

import okhttp3.FormBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;

/**
 * Created by libingn on 2017/12/21.
 */

public class OutboundSubmitPresenter extends OutboundSubmitContract.Presenter {
    @Override
    public void outboundSubmit(String order_id, String batch_sn,String batch_id, int ship_status, String attach,
                               String price_total, String remark, int ver, String items) {
        RequestBody requestBody = new FormBody.Builder()
                .add("order_id", order_id)
                .add("batch_sn", batch_sn)
                .add("batch_id", batch_id)
                .add("ship_status", ship_status+"")
                .add("attach", attach)
                .add("price_total", price_total)
                .add("remark", remark)
                .add("ver", ver+"")
                .add("items", items.toString())
                .build();
        mRxManage.addSubscription(Api.getDefault().gysChuKu(requestBody), new RxSubscriber<ResponseBody>(mContext,false) {
            @Override
            protected void _onNext(String result) {
                mView.outboundSubmitSuccess();
            }

            @Override
            protected void _onError(String message) {
                mView.outboundSubmitFail();
            }
        });
    }
}
